import http from '@/http/Http'
import type { ColListReq, ExportCompareDataReq } from './types'

export default class ExcelService {
  /**
   * @description 上传excel文件获取sheet列表
   * @param {string}
   * @return {HttpResponse} result
   */
  static async getSheetNameList(file: File) {
    const formData = new FormData()
    formData.append('file', file)
    return http.upload(`/getSheetNameList`, formData)
  }
  /**
   * @description excel所有列的list集合请求数据类型
   * @param {ColListReq}
   * @return {HttpResponse} result
   */
  static async getColList(data: ColListReq) {
    return http.post(`/getColList`, data)
  }

  /**
   * @description excel所有列的list集合请求数据类型以及sheet所有的行的list
   * @param {ColListReq}
   * @return {HttpResponse} result
   */
  static async getRowColList(data: ColListReq) {
    return http.post(`/getRowColList`, data)
  }

  /**
   * @description 根据类型导出比对的列
   * @param {ColListReq}
   * @return {HttpResponse} result
   */
  static async exportColCompareData(data: ExportCompareDataReq) {
    return http.exportExcel(`/exportColCompareData`, data)
  }
}
